<?php

namespace app\common\model;

use think\facade\Db;
use think\Model;

class AuthGroup extends Model
{
    /**
     * Use Thinkphp ORM Model
     */

    protected $autoWriteTimestamp = 'int';

    /**
     * 获取角色列表
     * @params string
     * @return
     */
    public static function getAuthGroup($admin_info = null, $status = 1, $field = 'id,name')
    {
        $query = Db::name('auth_group');
        if(!empty($admin_info) && $admin_info['rules'] != '*')
        {
            $query->where('id', $admin_info['group_id']);
        }
        if(isset($status) && is_numeric($status))
        {
            $query->where('status', $status);
        }
        if($field)
        {
            $query->field($field);
        }
        return $query->order('id asc')->select();
    }

}